package hero_summon

import (
	"go_server/game_server/api/service"
	"go_server/game_server/event_manager/event_data"
	"go_server/zinx/zlog"
)

type HeroSummonService struct {
	service.AbsService

	SummonHero *SummonHeroApi
	SummonShow *SummonShowApi

	eventMethods map[event_data.EventType]func(event event_data.IEvent)
}

const (
	HERO_SUMMON_ORDINARY_PRIZE_POOL = 1 // 英雄招募普通奖池
	HERO_SUMMON_SENIOR_PRIZE_POOL   = 2 // 英雄招募高级奖池
)

var (
	ServiceObj *HeroSummonService

	SummonTypes = []int32{HERO_SUMMON_ORDINARY_PRIZE_POOL, HERO_SUMMON_SENIOR_PRIZE_POOL} // 1、普通奖池;2,高级奖池
)

func init() {
	ServiceObj = &HeroSummonService{
		SummonHero: &SummonHeroApi{},
		SummonShow: &SummonShowApi{},

		eventMethods: make(map[event_data.EventType]func(event event_data.IEvent)),
	}
}

func (s *HeroSummonService) GetModuleName() string {
	return "hero_summon"
}

func (s *HeroSummonService) GetEventHandleFunc(eventType event_data.EventType) (func(event event_data.IEvent), bool) {
	eventFunc, ok := s.eventMethods[eventType]
	if !ok {
		zlog.Errorf("GetEventHandleFunc Err!!! method not found!! eventType: %d", eventType)
		return nil, false
	}
	return eventFunc, true
}

func (s *HeroSummonService) GetEventMap() map[event_data.EventType]func(event event_data.IEvent) {
	return s.eventMethods
}
